import React, {Component} from "react";
import {inject, observer, observable} from "mobx-react";
import {Redirect} from "react-router-dom"
import BaseVerify from "./BaseVerify"
import DetailVerify from "./DetailVerify"

@inject("studentVerifyStore")
@observer
class StudentVerify extends Component {
    render() {
        const {match} = this.props;
        const isVerify = this.props.studentVerifyStore.isVerify;
        const isSubmit = this.props.studentVerifyStore.isSubmit;
        if(isVerify ===true && isSubmit === true){
            alert("您的身份已成功验证，信息已完善");
            return(<div><Redirect to={'/'}/></div>)
        }
        return (
            <div>
                {
                    isVerify === false ?
                        (<BaseVerify studentVerifyModel={this.props.studentVerifyStore.studentVerifyModel} store={this.props.studentVerifyStore}/>)
                        :
                        isSubmit === true ? (<Redirect to={'/'}/>) : (<DetailVerify store={this.props.studentVerifyStore}/>)
                }
            </div>
        );
    }
}

export default StudentVerify;
